    <script type="text/javascript" src="js/register.js"></script>
<?php 
$id = isset($_GET['id'])?  $_GET['id'] : 0;
$selectQuery = "SELECT * FROM `users` WHERE `id`='$id'";
$result = mysql_query($selectQuery)or die(mysql_error());
$ans = mysql_fetch_assoc($result);
//////// GENDER CHECK 
$isMale = ($ans['gender'] == 0) ? 'checked':'';
$isFemale = ($ans['gender'] == 1) ? 'checked':'';
//////// LAng Cehck 
    $langArray = explode(',',$ans['lang']);
    
    $isC = in_array('c',$langArray)=== true ? 'selected':'';
    $isCpp = in_array('cpp',$langArray)=== true ? 'selected':'';
    $isPhp = in_array('php',$langArray)=== true ? 'selected':'';
    $isChash = in_array('chash',$langArray)=== true ? 'selected':'';
    $isDotNet = in_array('dotnet',$langArray)=== true ? 'selected':'';
    $ispython = in_array('python',$langArray)=== true ? 'selected':'';
////////// Check Hobbies 
    $hobbiesArray = explode(',',$ans['hobbies']);

$isCricket = in_array('cricket',$hobbiesArray )=== true ? 'checked':'';
$isHockey = in_array('hockey',$hobbiesArray )=== true ? 'checked':'';
$isFootball= in_array('football',$hobbiesArray )=== true ? 'checked':'';
$isTennis= in_array('tabletennis',$hobbiesArray )=== true ? 'checked':'';
$isCarrom= in_array('carrom',$hobbiesArray )=== true ? 'checked':'';
$isBollyball= in_array('bollyball',$hobbiesArray )=== true ? 'checked':'';
$isTableTennis= in_array('tableTennis',$hobbiesArray )=== true ? 'checked':'';
$isOthers= in_array('others',$hobbiesArray )=== true ? 'checked':'';
?> 
  <center><h3>Edit My profile</h3></center>
<form name="users" method="post" action="edit_saveuser.php" enctype="multipart/form-data">

<input type="hidden" name="id" value="<?=$ans['id']?>">

<input type="hidden" name="hiddenImage" value="<?=$ans['image']?>">

    <table border="0" width="100%" align="center"
    cellspacing="0">

      <thead>
        <tr>
          <th colspan="2">Please fill the details below...</th>
        </tr>
      </thead>

      <tbody>

        <tr>
          <td align="right" width="40%">Name :</td>
          <td><input type="text" name="name" 
          value="<?=$ans['name']?>"/></td>
        </tr>

        <tr>
          <td align="right">Email :</td>
          <td><input disabled type="text" name="email" value="<?=$ans['email']?>"/></td>
        </tr>

        <tr>
          <td align="right">Gender :</td>
          <td>
          <label class="radio inline" style="margin-left :15px;">
 <input name="gender" type="radio" value="0" <?=$isMale?> />
          Male</label>
          <label class="radio inline" style="margin-left :15px;">
 <input  name="gender" type="radio"  value="1" <?=$isFemale?> />
 Female</label></td>
        </tr>

        <tr>
          <td align="right">Phone :</td>
          <td><input type="text" name="phone" value="<?=$ans['phone']?>">
        </tr>

        <tr>
          <td align="right">Date Of birth :</td>
          <td><input type="text" name="dob" value="<?=$ans['dob']?>" /></td>
        </tr>

        <tr>
          <td align="right">Address :</td>
          <td><textarea name="address"><?=$ans['address']?></textarea></td>
        </tr>

        <tr>
          <td align="right">Country :</td>
          <td>
          <?php //pr(getCountries());?>
  <select name="country">
    <option>-SELECT-</option>
    <?php   foreach(getCountries() as $code=>$name) { 
      $select = ($code == $ans['country']) ? "selected" : '';
    
    ?>
    <option <?=$select?> value="<?=$code?>"><?=$name?></option>
    <?php   } ?>
  </select>
          </td>
        </tr>

        <tr>
          <td align="right">Prog Language :</td>
          <td>
  <select name="lang[]" multiple="true" style="height:100px;">
    <option value="c" <?=$isC?>>C</option>
    <option value="cpp" <?=$isCpp?>>C++</option>
    <option value="php" <?=$isPhp?>>PHP</option>
    <option value="chash" <?=$isChash?>>C#</option>
    <option value="dotnet" <?=$isDotNet?>>.NET</option>
    <option value="python" <?=$ispython?>>PYTHON</option>
  </select>
          </td>
        </tr>

        <tr>
          <td align="right">Hobbies :</td>
          <td>
            <div  style="width:450px;">
            <div style="float:left;">
              <div class="styleHobbies"><label class="radio "><input <?=$isCricket?> type="checkbox" value="cricket" name="hobbies[]"/>Cricket</label></div>
              <div class="styleHobbies"><label class="radio "><input <?=$isHockey?> type="checkbox"  value="hockey" name="hobbies[]"/>Hockey</label></div>
              <div checked class="styleHobbies"><label class="radio "><input type="checkbox"  value="football" <?=$isFootball?> name="hobbies[]"/>Football</label></div>
            </div>
            
            <div style="float:left;">
              <div class="styleHobbies"><label class="radio "><input type="checkbox"  value="tennis" <?=$isTennis?> name="hobbies[]"/>Tennis</label></div>
              <div class="styleHobbies"><label class="radio "><input <?=$isCarrom?> type="checkbox"  value="carrom" name="hobbies[]"/>Carrom</label></div>
              <div class="styleHobbies"><label class="radio "><input type="checkbox"  value="bollyball" <?=$isBollyball?> name="hobbies[]"/>Bollyball</label></div>
            </div>
            
            <div  style="float:left;">
              <div class="styleHobbies"><label class="radio "><input <?=$isTableTennis?> type="checkbox"  value="tabletennis" name="hobbies[]"/>TableTennis</label></div>
              <div class="styleHobbies"><label class="radio "><input <?=$isOthers?> type="checkbox"  value="others" name="hobbies[]"/>Others</label></div>
            </div>
            </div>
          </td>
        </tr>

        <tr>
          <td align="right">Image :</td>
          <td><input type="file" name="image"/>
          <img height="90" width="120" src="uploads/<?=$ans['image']?>" >
          </td>
        </tr>
        <tr>
          <td align="right">&nbsp;</td>
          <td><input onClick="submitClick();" type="botton" class="sbmt" value="I am done!!!!"/></td>
        </tr>

      </thead>

    </table>

 </form>
<script type="text/javascript">
  function submitClick(){
    document.users.submit();
  }
</script>